<template>
  <view class="content">
    <view class="kong"></view>
    <view class="top1 flexs2">
      <image class="up_img"
             @click="goback"
             src="../../static/image/ico_dh_bk@2x.png"></image>
      <view class="titles">留言</view>
      <view class="status">
        <image src="../../static/image/ly_ico_jl@2x.png"
               mode=""></image>
      </view>
    </view>
    <view class="text_box">
      <textarea value=""
                @input="textChange"
                placeholder="请输入留言内容"
                v-model="content"
                placeholder-class="input_class"
                maxlength="140" />
      <view class="text_tip">{{textNum}}/140字</view>
    </view>
    <view @click="save"
          class="btn">提交</view>

  </view>
</template>

<script>
export default {
  data() {
    return {
      textNum: 0,
      id: '',
      content: ''
    }
  },
  onLoad(e) {
    console.log(e.id)
    this.id = e.id
  },
  methods: {
    textChange(e) {
      this.textNum = e.detail.cursor
    },
    async save() {
      let { data } = await this.$http.post('/company/msg', { c_id: this.id, msg: this.content })
      uni.showToast({
        title: data.msg,
        icon: 'none'
      })
      // setTimeout(() => {
      //   uni.navigateTo({
      //     url:'/pages/kaoq/'
      //   })
      // })
    }
  }
}
</script>

<style>
.content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #f5f5f5;
}
.kong {
  width: 100%;
  background-color: white;
  height: var(--status-bar-height);
}
.top1 {
  width: 100%;
  height: 89rpx;
  padding: 0rpx 30rpx;
  border-bottom: 1px solid #f2f2f2;
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.up_img {
  width: 20rpx;
  height: 36rpx;
}
.titles {
  font-size: 34rpx;
  color: #000000;
}
.status image {
  width: 36rpx;
  height: 36rpx;
}
.text_box {
  width: 92%;
  height: 424rpx;
  margin: auto;
  margin-top: 20rpx;
  background: #ffffff;
  border-radius: 10rpx;
  padding: 29rpx 20rpx;
}
textarea {
  width: 100%;
  height: 330rpx;
}
.input_class {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
.text_tip {
  width: 100%;
  text-align: end;
  font-size: 24rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
.btn {
  width: 650rpx;
  height: 88rpx;
  background: #ffdd47;
  border-radius: 10rpx;
  margin: auto;
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 80rpx;
}
</style>
